home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr35
/
dwnsrs57.zip
/
DOWNSORT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-15
|
5KB
|
129 lines
/* ============================================================= */
/* Rob Hamerling's MAXIMUS download file scan and sort utility */
/* -> DOWNSORT.C */
/* -> Mainline */
/* */
/* When compiled with IBM C Set/2 compiler, a 32-bit OS/2 */
/* version will be generated (via compiler variable __32BIT__). */
/* Note: the 'migration' option is still necessary (-Sm), and */
/* for Maximus' mstruct.h the -D__386__ is also needed. */
/* When compiled by MicroSoft C compiler 6.00a a 16-bit program */
/* will be generated for OS/2 or DOS. */
/* ============================================================= */
#define INCL_BASE
#define INCL_NOPMAPI
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "..\max\mstruct.h"
#include "downsort.h"
#include "downfpro.h"
/* prototypes of local functions */
unsigned int collect_area(DOWNPATH _HUGE **);
unsigned int collect_file(unsigned int, DOWNPATH _HUGE *);
void get_parm(int, char *[]);
FILECHAIN **prep_sort(unsigned int, FILECHAIN *);
void make_bbs(FILECHAIN **, DOWNPATH _HUGE *, unsigned int);
void make_all(FILECHAIN **, DOWNPATH _HUGE *, unsigned int);
void make_dup(FILECHAIN **, unsigned int);
void make_fil(FILECHAIN **, DOWNPATH _HUGE *, unsigned int);
void make_gbl(FILECHAIN **, DOWNPATH _HUGE *, unsigned int);
void make_ipf(FILECHAIN **, DOWNPATH _HUGE *, unsigned int);
void make_ip2(FILECHAIN **, DOWNPATH _HUGE *, unsigned int);
void make_new(FILECHAIN **, DOWNPATH _HUGE *, unsigned int);
void make_ok( FILECHAIN **, DOWNPATH _HUGE *, unsigned int);
void make_orp(FILECHAIN **, DOWNPATH _HUGE *, unsigned int);
void make_emi(FILECHAIN **, DOWNPATH _HUGE *, unsigned int);
/* ====================== */
/* M A I N L I N E */
/* ====================== */
void main(int argc, char *argv[])
{
struct _downpath _HUGE *area; /* pointer to area-info arrays*/
struct _filechain **dm; /* pointer to file-sort array */
unsigned int i; /* counters */
long start_time,run_time; /* for execution time meas. */
#define MAX_FILES 16350
start_time = time(NULL); /* system time at start */
sprintf(list_title,"%s%c%c%c",PROGNAME,VERSION,SUBVERS,SUFFIX);
/* build default title */
get_parm(argc, argv); /* system and oper. parameters*/
/* and display welcome msg */
area_total_count = collect_area(&area); /* build area array */
if (area_total_count <= 0) { /* no area's included */
printf(MSG_ZF, "-area");
printf(MSG_ZP, PROGNAME);
DosExit(0, 8);
}
if (oper_mode == VERBOSE)
fprintf(stdout, "Collecting information from %u file-area's\n",
area_total_count);
file_total_count = collect_file(area_total_count, area);
if (file_total_count == 0) { /* no files */
fprintf(stdout, MSG_ZF, "");
fprintf(stdout, MSG_ZP, PROGNAME);
DosExit(0, 10);
}
if (file_total_count > MAX_FILES) { /* array must fit in segment! */
fprintf(stdout, MSG_ZY, MAX_FILES, PROGNAME);
DosExit(0, 10);
}
dm = prep_sort(file_total_count, first_element); /* make sort array */
if (lp[P_ORP].priv[0] <= HIDDEN) /* ORPHAN-list */
make_orp(dm, area, 0);
if (lp[P_DUP].priv[0] <= HIDDEN) /* DUP-list */
make_dup(dm, 0);
for (i=0; i<10 && lp[P_OK].priv[i] <= HIDDEN; i++) /* OKFile(s) */
make_ok(dm, area, i);
if (lp[P_BBS].priv[0] <= HIDDEN) /* BBS-list */
make_bbs(dm, area, 0);
for (i=0; i<10 && lp[P_NEW].priv[i] <= HIDDEN; i++) /* NEW-list(s) */
make_new(dm, area, i);
for (i=0; i<10 && lp[P_EMI].priv[i] <= HIDDEN; i++) /* EMI-list(s) */
make_emi(dm, area, i);
for (i=0; i<10 && lp[P_GBL].priv[i] <= HIDDEN; i++) /* GBL-list(s) */
make_gbl(dm, area, i);
for (i=0; i<10 && lp[P_ALL].priv[i] <= HIDDEN; i++) /* ALL-list(s) */
make_all(dm, area, i);
for (i=0; i<10 && lp[P_IPF].priv[i] <= HIDDEN; i++) /* IPF-list(s) */
make_ipf(dm, area, i);
for (i=0; i<10 && lp[P_IP2].priv[i] <= HIDDEN; i++) /* IPF2-list(s)*/
make_ip2(dm, area, i);
if (lp[P_FIL].priv[0] <= HIDDEN) /* FILES.BBS */
make_fil(dm, area, 0);
if (oper_mode != QUIET) {
printf("\n%s version %c.%c%c by %s ",
PROGNAME,VERSION,SUBVERS,SUFFIX,AUTHOR);
run_time = time(NULL) - start_time; /* execution time in seconds */
printf("completed in %ld minutes and %ld seconds.\n\n",
run_time/60,run_time%60); /* report execution time */
}
else
printf("\n");
DosExit(0,0); /* Automatic release all storage! */
}